<?php
/**
 * Created by PhpStorm.
 * User: junyv
 * Date: 2016/9/18
 * Time: 11:52
 */

namespace app\manage\controller;
class Ask extends Base
{
    protected $beforeActionList = [
        'beforeIndex'  =>  ['only'=>'index'],
        'beforeEdit'   => ['only'=>'edit']
    ];
    public function beforeIndex(){
        $this->_exclude =  'edit';
        $this->_data = [
            'view'    => [
                'c' => 'Ask',
                'a' => 'edit',
                'str'    => '<a href="%s">查看</a>',
                'param' => ['id'=>'@id@'],
                'isajax' => 0,
                'replace'=> ''
            ],
        ];
    }
    public function beforeEdit(){
        $id = input('param.id/d',0);
        $this->assign('list_table',true);
        if($id){
            $where['ask_id'] = $id;
            $lists = model('answer')->where($where)->select();
            $this->assign('lists',$lists);
        }
    }
}